Thursday, September 17, 2009

Writing Plug-Ins for Loose Coupling of Application Components

How do I write a Plug-in for an application and how do I know whether a DLL implements an Interface that my application expects? Dependency Injection and Inversion of Control are hot topics in OOP development today. These terms sound complex and their implementation can indeed be complex. There are several ways of implementing Dependency Injection, but in this article I am going to describe a type of DI that is not normally covered under the definition of this term.

Check out my article at http://www.knowdotnet.com/articles/pluginsusingreflection.html.

While you are there, take a look at Visual Class Organizer, a time saving tool for automatically organizing your classes. click on the following link to download a Free 30 Day Trial.

http://www.knowdotnet.com/articles/VisualOrganizerProductHome.html

Labels: , ,

Disable or Change the Way Windows Updates Are Performed

Are you constantly having the Windows Update popup tell you that Windows has been upadated and is going to reboot? Have you forgotten and lost some of your work because of an automatic reboot? Here is how to change the way that Windows Updates work.

Check out a new article at
http://www.knowdotnet.com/articles/windowsupdates.html

While you are there, take a look at Visual Class Organizer, a time saving tool for organizing your classes. Click the link below for a 30 Day Free Trial.

http://www.knowdotnet.com/articles/VisualOrganizerProductHome.html

Labels:

Tuesday, July 10, 2007

At KnowDotNet, I have just released a hot new product called Visual Class Organizer. If you would like to automatically organize your code window by logical groups of code elements, sort your code elements within the groups, and optionally surround the groups with Regions, it can all be done visually with Visual Class Orgainzer.

I have spent well over a year in the development of this exciting new product. It came from a need of my own to have a way to do everything that I have described above in a visual way. The product allows you to organize a code window in a matter of seconds, regardless of how much code you may have in it.

In addition to the automatic options, you can manually organize your code window with drag and drop in a dialog that provides complete freedom and power to do it your way.

Try the free 30-day trial at

http://www.knowdotnet.com/articles/VisualOrganizerProductHome.html

You can also watch a short video that demos the power of the add-in by clicking the demo link on the same page.

Labels: , ,

Thursday, December 07, 2006

Les Smith .NET Blog

I just posted a rather lengthy article on extending the functionality of the CodeModel or better yet, the FileCodeModel. In spite of the functionality that it has, it still lacks functionality and this article shows some neat tricks for finding and retrieveing code that the CodeModel cannot do.

I think you will find some help here, if you are interested in the CodeModel, Regexes, and extensibility in general. Hope you like it.

The link is

http://www.knowdotnet.com/articles/extendingthecodemodel.html

Take a look.

Friday, April 28, 2006

Programmers do the dumbest things

Ever do something really stupid in your code? I bet you can't say "No" with a straight face. But, don't you get irritated when you encounter someone else's blunders. I have found some real dillys lately and thought I might run them by anyone that ever reads my blog, which at this point is not a lot of people.

It seems that a lot of self-named .NET developers totally don't understand Exception Handling! For example, explain the need for the following Try Catch block, if you can.

private void DoNothing()
{
   try
   {
      // do some code
   }
   catch(Exception ex)
   {
      throw(ex);
   }
}

Did it never occur to the writer of this code that if they had not coded the try catch, that the results of a failure in the DoNothing method will be exactly the same. The try catch as coded basically is an unhandled exception, which could have been raised without the try catch.

Here's one more that completely baffled me when I came upon it recently.

Try
   IO.File.Move(oldPath, newPath)
Catch (ex As Exception)
   IO.File.Move(oldPath, newPath)
End Try

Go Figure! What is this? "If at first you don't succeed, Try, Try again?"

Take a minute and comment with something really dumb that you have done or seen.

Infamous Last Words

Programmers are infamous for trying to pass the buck when there appears to be a problem with their program and they are facing their accuser who is pointing the finger at them. For many years I have been amused at the new answers that the “innocent” developer comes up with before finally having to admit that they blew it. A short list is compiled below.

“Sounds like a hardware problem to me…”

“I only changed one line and it wasn’t in that area of the program…”

“It runs on my machine…”

“I tested it once and it ran ok. If it runs once, it will run every time, right?”

“I only made a change to the database; it would not cause a problem in the program…”

“The program has been running for 5 months and I never had a problem, I don’t think it’s the program…”


"Why would you ask if the change had been through QA?"

This one really backfires when you tell the user, who is a customer, “It sounds like an ID10T Error.” I personally don’t recommend that one be used at all.

Should you have some that you have heard, please comment on this blog.

Wednesday, February 15, 2006

VS2005 .NET Add-Ins Nested Menus

Writing an add-in for Visual Studio .NET always brings it's challenges. With every release of .NET, if you are an ISV, as I am, there are several challenges.

First, you have to see what features of your add-ins that Microsoft has implemented in the new IDE. When they do this, and I have never seen a new version since VB4 that did not implement something that I had previously done in one of my add-ins and it is no longer needed in a new version.

Sometimes, the way Microsoft implements it, you can find a way to do more than they have done it, and with greater functionality. You are not much of a programmer, if you can look at functionality and not improve on it, or look at a medium to large block of code and not be able to improve, reorganize, or make it be more efficient, etc.

Another challenge is to look at the new IDE and see if you can find something that is useful that MS has not implemented. If you are an application developer and you write add-ins as I do, you have an advantage over Microsoft in that you are using the IDE every minute of everyday and you constantly run into tasks that are repetitive and that just say, "automate me."

Finally, there is the challenge of finding out what has changed in the automation or extensibility model of the new release that breaks your add-ins. It's not usually hard to find out what is broken, the real challenge is to find out how to fix it.

That is the case with menus in add-ins in VS2005. Microsoft created a trimmed down version of Microsoft Office CommandBars. At first you think, "this is neat." At a second look, you find there is no free lunch. The cost here is that the command bars and their associated events do not work exactly the same as the MS Office counterpart. Especially is this true with respect to event handlers for the menus. I thought I would never get them working, and said, "nothing is this hard!" And actually it isn't; all you have to do is discover what the one way that it will work is.

I finally did and have posted an article on KnowDotNet so that you hopefully won't have the agony that I experienced. The article is at http://www.knowdotnet.com/articles/nestedmenusinvs2005.html.

I hope you will find it helpful.

Tuesday, February 14, 2006

I have just uploaded NetRefactor2005 on the KnowDotNet site. It has all the features of NetRefactor for previous versions of Visual Studio .NET. It was a while in being released because of learning to deploy addins in VS2005.

Microsoft did remove some of the "COM" ness from addins in VS2005, but the Addin Wizard does not do as much for you in the new version. It actually does nothing for you in the setup and deployment area. In fact, it does not even create a Setup project for you. Deployment is completely up to the developer. I have written an article on deployment at http://knowdotnet.com/articles/addininstallation.html. It has some useful code that will help you to get your addins deployed.

I am beginning to write articles on addin development for VS2005. I would like feedback or suggestions on articles that developers would like to see on this or other .NET subjects. I can't write on everything, but my partners and I together can take a crack at a lot of subjects.

Let me hear from you.

Thursday, May 27, 2004

Book Review - Microsoft Visual Basic .NET Programmer's Cookbook

I have just posted a book review on Matthew MacDonald's VB.NET Programmer's Cookbook. You can read it at See Les's Articles. This is one of the most helpful books that I have ever owned, a must have for anyone new to the .NET Framework. Although I have been developing in VB.NET since Beta 1, I still refer to this book regularly. If you are new to VB.NET, this is a must have book.